﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 员工档案补录和更新的工号和手机号非唯一索引继续优化 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_SysPerson_Phone_Discriminator",
                table: "SysPerson");

            migrationBuilder.DropIndex(
                name: "IX_SysPerson_StaffNo_Discriminator",
                table: "SysPerson");

            migrationBuilder.CreateIndex(
                name: "IX_SysPerson_Phone_Discriminator",
                table: "SysPerson",
                columns: new[] { "Phone", "Discriminator" },
                unique: true,
                filter: "Phone IS NOT NULL AND Discriminator = 'SysPerson'");

            migrationBuilder.CreateIndex(
                name: "IX_SysPerson_StaffNo_Discriminator",
                table: "SysPerson",
                columns: new[] { "StaffNo", "Discriminator" },
                unique: true,
                filter: "Discriminator = 'SysPerson'");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_SysPerson_Phone_Discriminator",
                table: "SysPerson");

            migrationBuilder.DropIndex(
                name: "IX_SysPerson_StaffNo_Discriminator",
                table: "SysPerson");

            migrationBuilder.CreateIndex(
                name: "IX_SysPerson_Phone_Discriminator",
                table: "SysPerson",
                columns: new[] { "Phone", "Discriminator" },
                unique: true,
                filter: "Phone IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_SysPerson_StaffNo_Discriminator",
                table: "SysPerson",
                columns: new[] { "StaffNo", "Discriminator" },
                unique: true);
        }
    }
}
